home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.cyberramp.net!news
- From: sinan@cyberramp.net (John Noland)
- Newsgroups: comp.lang.c
- Subject: Re: How do I modify a character string that's declared as an array of char?
- Date: 25 Feb 1996 22:34:43 GMT
- Organization: Prose Software
- Distribution: world
- Message-ID: <4gqo63$2pr@newshost.cyberramp.net>
- References: <4gj2nl$840@mirzam.usc.edu>
- NNTP-Posting-Host: ramp3-4.cyberramp.net
- X-Newsreader: WinVN 0.99.5
-
- In article <4gj2nl$840@mirzam.usc.edu>, awawda@mirzam.usc.edu says...
- >
- >How do I write a function that can modify a string that was declared
- >as an array of characters?
- >
- >for example:
- >
- >myfunction(char **s)
- ^^
- You only need one of these
-
- >{
- > // modify string s
- >}
- >
- >main()
- >{
- > char mydata[50];
- >
- > strcpy(mydata,"test string");
- > myfunction(&mydata);
- ^
- Dereferencing mydata isn't necessary. mydata is a pointer to the first
- character of your array, so what you're really doing is passing a pointer
- to that pointer.
-
- -John
-
-